#include "SphereSetting.h"

SphereSettingDialog::SphereSettingDialog(Sphere* sph, QWidget* parent) : QDialog(parent), sph(sph)
{
	ui.setupUi(this);
	ui.px->setValue(sph->cen.x());
	ui.py->setValue(sph->cen.y());
	ui.pz->setValue(sph->cen.z());
	ui.radius->setValue(sph->rad);
	connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyChange()));
	connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(setMaterial()));
	
}

void SphereSettingDialog::applyChange()
{
	sph->cen.setX(ui.px->value());
	sph->cen.setY(ui.py->value());
	sph->cen.setZ(ui.pz->value());
	sph->rad = ui.radius->value();
}

void SphereSettingDialog::setMaterial()
{
	ms = new MaterialSetting(sph, this);
	ms->exec();
	delete ms;
}